package eg.backend.repository.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import eg.backend.base.GoalStatus;
import eg.backend.base.repository.EntityRepositoryImpl;
import eg.backend.domain.Goal;
import eg.backend.repository.GoalRepository;

public class GoalRepositoryImpl extends EntityRepositoryImpl<Goal, String> implements GoalRepository {
	public List<Goal> findByUser(String user) {
		String queryName = "Goal.findByUser";
		Map<String, Object> queryParams = new HashMap<String, Object>();
		queryParams.put("user", user);
		return this.findByNamedQuery(queryName, queryParams);
	}

	public List<Goal> findByUserAndStatus(GoalStatus status, String user) {
		String queryName = "Goal.findByUserAndStatus";
		Map<String, Object> queryParams = new HashMap<String, Object>();
		queryParams.put("user", user);
		queryParams.put("status", status);
		return this.findByNamedQuery(queryName, queryParams);
	}

}
